<template>
  <el-dialog :title="title" :width="width" :visible.sync="isShowVisible" center :close-on-click-modal="false" :before-close="() => $emit('close')">
    <el-card v-loading="isLoading">
      <el-form label-width="105px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="分类名称:">
              <span>{{groupData.ename}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分类编码:">
              <span>{{groupData.enumber}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="上级分类:">
         <el-select v-model="groupData.eparentid" :disabled="groupId != 0" disabled class="select-disabled">
            <el-option v-for="item in groupList" :key="item.nodeId" :label="item.nodeName" :value="item.nodeId">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </el-card>
    <div slot="footer" class="dialog-footer">
      <el-button @click="$emit('close')">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import EquipmentCategoryApi from "@/api/module/EquipmentCategoryApi";

    export default {
      name: "equipment_detail",
      props: {
        width: {
          type: String,
          default: '60vw'
        },
        groupId: {
          type: Number,
        },
      },
      data () {
        return {
          title: '分类详情',
          isShowVisible: true,
          isLoading: false,
          groupData: {},
          groupList: [],
          http:new EquipmentCategoryApi(),
        }
      },
      async created () {
        this.isLoading = true
        let groupList = await this.http.queryGroupTree({})
        this.groupList = groupList.data
        let groupData = await this.http.detail({ eid: this.groupId })
        this.groupData = groupData.data
        this.isLoading = false
        console.log("分组---分类详情")
        console.log(groupData)
        console.log(groupList)
      },
    }
</script>

<style scoped>

</style>
